import { Inject, Injectable } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
// import { JwtService } from '@nestjs/jwt';

@Injectable()
export class AuthService {
  // constructor(private readonly jwtService: JwtService) {}

  @Inject(JwtService)
  private readonly jwtService: JwtService;

  async creatToken(user) {
    const payload = { username: user.username, sub: user.userId };
    return this.jwtService.sign(payload);
  }

  async varifyToken(token) {
    return this.jwtService.verify(token);
  }
}
